import { NativeModules } from 'react-native';

type MobileIMType = {
  enableProd(): void;
  init(domain: string, port: number): Promise<string>;
  login(userId: string, token: string): Promise<number>;
  loginWithExtra(userId: string, token: string, extra: string): Promise<number>;
  hasLogin(): Promise<boolean>;
  send(
    content: string,
    toId: string,
    fp: string,
    typeU: number
  ): Promise<number>;
  logout(): Promise<number>;
  ON_LOGIN_RESPONSE: string;
  ON_LINK_CLOSE: string;
  ON_KICK_OUT: string;
  ON_RECEIVE_MESSAGE: string;
  ON_ERROR_RESPONSE: string;
  MESSAGES_LOST: string;
  MESSAGES_BE_RECEIVED: string;
};

const { MobileIM } = NativeModules;

export { MobileIM };

export default MobileIM as MobileIMType;
